<?php

/*
	author: d3m
	Returns an array with the categories and entities found.
	if user hasn't login, then userId is -1
*/
function BL_simpleSearch( $userId, $query)
{
    /* Replace some common characters with metacharacter % */
	$query = str_ireplace("'", "%", $query);
	$query = str_ireplace("-", "%", $query);
	$query = str_ireplace("*", "%", $query);
	
	$query .= "%";
	$query = "%" . $query;

	$categories = DB_searchCategories($userId, $query);
	$entities = DB_searchEntities($userId, $query);

	$returnArray[0] = $categories;
	$returnArray[1] = $entities;

	return $returnArray;
}
?>
